import { useSelector } from 'react-redux'
import type { StoreState, StoreStateType } from '@/redux'

/**
 * @description 获取redux指定模块状态
 * @param name 模块名称
 * @returns 模块状态
 */
export const useGetState = function <T>(name: StoreStateType): T {
    return useSelector((state: StoreState<T>) => state[name])
}
